package com.kusiri.kframework.component
{
	import com.kusiri.kframework.KfContext;
	
	import mx.collections.ArrayCollection;

	/**
	 * 
	 */
	public class KfComponentCollection extends ArrayCollection implements IKfComponent
	{
		private var _generatorId : String;
		
		/**
		 * Gets the identifier for this singleton or generating factory
		 */
		public function get __generatorId() : String
		{
			return _generatorId;
		}
		
		/**
		 * Gets the identifier for this singleton or generating factory
		 */
		public function set __generatorId(generatorId : String) : void
		{
			_generatorId = generatorId;
		}
		
		private var _module : KfContext;
		
		/**
		 * Gets the spawning module
		 */
		public function get __context() : KfContext
		{
			return _module;
		}
		
		/**
		 * Sets the spawning module
		 */
		public function set __context(module : KfContext) : void
		{
			_module = module;
		}
		
		/**
		 * Tell the Component to get ready to be used.
		 * 
		 * Called from the KfComponentManager, not called directly.
		 * 
		 * Callback functions take component, and the error (if applicable) as the argument
		 */
		public function __initializeComponent(onSuccess : Function, onFail : Function) : void
		{
			onSuccess(this);
		}
		
	}
}